home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / util / DSmacros.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  3KB  |  84 lines

  1. /*    $Header: /usr/people/sam/fax/util/RCS/DSmacros.h,v 1.5 1994/02/28 14:23:44 sam Rel $ */
  2. /*
  3.  * Copyright (c) 1990, 1991, 1992, 1993, 1994 Sam Leffler
  4.  * Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and 
  7.  * its documentation for any purpose is hereby granted without fee, provided
  8.  * that (i) the above copyright notices and this permission notice appear in
  9.  * all copies of the software and related documentation, and (ii) the names of
  10.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  11.  * publicity relating to the software without the specific, prior written
  12.  * permission of Sam Leffler and Silicon Graphics.
  13.  * 
  14.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  15.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  16.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  17.  * 
  18.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  22.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  23.  * OF THIS SOFTWARE.
  24.  */
  25. #ifndef _DSmacros_
  26. #define    _DSmacros_
  27. // $Revision: 1.5 $
  28. // $Date: 1994/02/28 14:23:44 $
  29. #include "Types.h"
  30.  
  31. // ----------------- copy macros ---------------------------------------------
  32. #define fxIMPLEMENT_copyStruct(CLASS,FIELD,TYPE)            \
  33. void CLASS::fxCAT(copy,FIELD)(void const *s, void *d) const        \
  34. {   *((TYPE *)d) = *(TYPE const *)s; }                    \
  35. __enddef__
  36.  
  37. #define fxIMPLEMENT_copyObj(CLASS,FIELD,TYPE)                \
  38. void CLASS::fxCAT(copy,FIELD)(void const *s, void *d) const        \
  39. {   fxNEW(d) TYPE(*(TYPE const *)s); }                    \
  40. __enddef__
  41.  
  42. #define fxIMPLEMENT_copyPtr(CLASS,FIELD,TYPE)                \
  43.     fxIMPLEMENT_copyStruct(CLASS,FIELD,TYPE)            \
  44. __enddef__
  45. #define fxIMPLEMENT_copyObjPtr(CLASS,FIELD,TYPE)            \
  46.     fxIMPLEMENT_copyObj(CLASS,FIELD,TYPE)                \
  47. __enddef__
  48.  
  49. // ----------------- create macros -------------------------------------------
  50. #define fxIMPLEMENT_createObj(CLASS,FIELD,TYPE)                \
  51. void CLASS::fxCAT(create,FIELD)(void *d) const { fxNEW(d) TYPE; }    \
  52. __enddef__
  53.  
  54. #define fxIMPLEMENT_createPtr(CLASS,FIELD,TYPE)                \
  55. void CLASS::fxCAT(create,FIELD)(void *d) const {*(TYPE *)d = 0;}    \
  56. __enddef__
  57.  
  58. #define fxIMPLEMENT_createObjPtr(CLASS,FIELD,TYPE)            \
  59.     fxIMPLEMENT_createObj(CLASS,FIELD,TYPE)                \
  60. __enddef__
  61.  
  62. #define fxIMPLEMENT_createStruct(CLASS,FIELD,TYPE)            \
  63. void CLASS::fxCAT(create,FIELD)(void *) const {}            \
  64. __enddef__
  65.  
  66. // ----------------- destroy macros ------------------------------------------
  67. #define fxIMPLEMENT_destroyStruct(CLASS,FIELD,TYPE)            \
  68. void CLASS::fxCAT(destroy,FIELD)(void *) const {}            \
  69. __enddef__
  70.  
  71. #define fxIMPLEMENT_destroyObj(CLASS,FIELD,TYPE)            \
  72. void CLASS::fxCAT(destroy,FIELD)(void *d) const                \
  73. {   ((TYPE *)d)->TYPE::~TYPE();    }                    \
  74. __enddef__
  75.  
  76. #define fxIMPLEMENT_destroyPtr(CLASS,FIELD,TYPE)            \
  77.     fxIMPLEMENT_destroyStruct(CLASS,FIELD,TYPE)                \
  78. __enddef__
  79.  
  80. #define fxIMPLEMENT_destroyObjPtr(CLASS,FIELD,TYPE)            \
  81.     fxIMPLEMENT_destroyObj(CLASS,FIELD,TYPE)                \
  82. __enddef__
  83. #endif /* _DSmacros_ */
  84.